[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
strnset() Initialize n Characters of String
#include <string.h> Required for declarations only
char *strnset(string,ch,n);
char *string; String to be initialized
int ch; Character setting
size_t n; Number of characters to be set
strnset() sets a maximum of 'n' bytes of 'string' to the character
'ch'. If the length of 'string' is less than 'n', the length of
'string' is used instead of 'n'.
Returns: A pointer to the initialized string.
Notes: Use strset() to set all of the characters in string.
-------------------------------- Example ---------------------------------
The following statements copy Xs over the first 4 characters in
'string'.
#include <string.h>
char string[30] = "AJAX Construction Co.";
char *sptr;
main()
{
sptr = strnset(string,'X',4);
printf("%s",sptr);
}
See Also:
strset()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson